// 导入express
const expressJoi = require('@escook/express-joi')
const express = require('express')
// 从文章管理路由处理函数模块按需导入处理函数
const { getCates, addCate, deleteCate } = require('../router_handler/articate_handler')
// 从文章分类验证对象模块按需导入验证对象
const { reg_addCate_schema, reg_deleteCate_schema, get_cate_schema } = require('../schema/articate')

// 创建 路由对象
const router = express.Router()

// 定义路由规则
// 获取文章分类列表
router.get('/cates', expressJoi(get_cate_schema), getCates)

// 新增文章分类
router.post('/addcate', expressJoi(reg_addCate_schema), addCate)

// 删除文章分类
router.get('/deletecate/:id', expressJoi(reg_deleteCate_schema), deleteCate)

// 向外暴露 路由对象
module.exports = router